//上传图片到七牛服务器;
var express = require('express'); //引入express模块
var router = express.Router(); //引入express路由
var qiniu = require("qiniu"); //引入七牛
const accessKey = 'XSa_r5jjWptmorLurKyO4jFWoXJExzFygkpxXJks';
const secretKey = 'FNcC_YYo2Mvn1ukaDY2v31tiKTYRw9fkCP5VfLDb';
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey);


router.post('/', (req, res) => {
    const options = {
        scope: 'dom1',
      };
      const putPolicy = new qiniu.rs.PutPolicy(options);
      const uploadToken=putPolicy.uploadToken(mac);  // 向七牛云发送一个接口生成上传凭证
      res.send({code:0,success:true,data:uploadToken})
})
module.exports = router;